import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

import 'pull_refresh_common.dart';

mixin PullRefreshControllerStateMixin<T extends StatefulWidget> on State<T> {
  final RefreshController refreshController = RefreshController();
  PageStatus pageStatus = PageStatus.loading;
  int page = 1;

  // 结束刷新
  void endrefresh({required bool noData}) {
    refreshController.refreshCompleted();
    noData ? refreshController.loadNoData() : refreshController.loadComplete();
  }

  // 结束加载更多
  void endLoadMore({required bool noData}) {
    noData ? refreshController.loadNoData() : refreshController.loadComplete();
  }

  @override
  void dispose() {
    // refreshController.dispose();
    super.dispose();
  }
}
